const db = wx.cloud.database();
Page({

  data: {
    receiveList: [],
  },
  // 审核内容
  toExamine(e) {
    wx.showLoading({
      title: '加载中',
    })
    const { item: { _id }, name } = e.currentTarget.dataset;
    wx.cloud.callFunction({
      name: 'toExamine',
      data: {
        _id,
        state: name,
        examinePerson: wx.getStorageSync('openid') 
      },
      success: (res) => {
        this.onLoad();
        wx.hideLoading();
      }
    })
 },

/* db.collection('orderReceive').doc(_id).update({
  data: {
    state: name,
    examinePerson: wx.getStorageSync('openid') 
  },
  success: (res) => {
    this.onLoad();
    wx.hideLoading();
  }
}) */
  

/* 点击图片放大预览 */
  preview: function (res) {
    console.log(res)
/*     wx.previewImage({
      urls: [res.currentTarget.dataset.url],
    }) */
  },


  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    db.collection('orderReceive').where({
      state: '待审核'
    }).get({
      success: (res) => {
        console.log(res)
        this.setData({
          receiveList: res.data
        })
      }
    })
  },

 
})